package com.tanhua.manage.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tanhua.manage.mapper.UserInfoMapper;
import com.tanhua.manage.pojo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.aggregation.ArrayOperators;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserInfoService {

    @Autowired
    private UserInfoMapper userInfoMapper;

    //根据分页,来搜索用户信息集合
    public IPage<UserInfo> queryByPage(QueryWrapper<UserInfo> queryWrapper,Integer page,Integer pageSize){
        IPage<UserInfo> ipage = new Page<>(page,pageSize);
        return this.userInfoMapper.selectPage(ipage,queryWrapper);
    }

    //根据wrapper来搜索用户信息集合
    public List<UserInfo>queryUserInfoList(QueryWrapper<UserInfo> queryWrapper){
        return this.userInfoMapper.selectList(queryWrapper);
    }

    //根据用户id来搜索用户个人信息
    public UserInfo queryUserInfoById(Long id){
        return this.userInfoMapper.selectById(id);
    }
}
